import 'package:demo_app_video/page/home_main.dart';
import 'package:demo_app_video/page/login.dart';
import 'package:demo_app_video/splash.dart';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_adcontent/flutter_adcontent.dart';
import 'package:uuid/uuid.dart';
import './commons/router/routes.dart';
import './commons/router/routes_handle.dart';
import 'csj.dart';
import 'package:fluro/fluro.dart';
import './commons/sp.dart';
import 'store/user.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

void main() async {
  // 绑定引擎
  WidgetsFlutterBinding.ensureInitialized();

  if (Platform.isAndroid) {
    SystemUiOverlayStyle style = const SystemUiOverlayStyle(

        /// 设置状态栏背景为透明色fv
        statusBarColor: Colors.transparent,

        ///设置状态栏文字为白色，dark为黑色
        statusBarIconBrightness: Brightness.dark,
        statusBarBrightness: Brightness.dark);

    /// 应用上面的style设置
    SystemChrome.setSystemUIOverlayStyle(style);
  } else {
    SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light);
  }
  SystemChrome.setPreferredOrientations([
    DeviceOrientation.portraitUp,
  ]);
  // await Csj().init();
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) => MaterialApp(
        title: '黄苹果免费短剧',
        debugShowCheckedModeBanner: false,
        theme: ThemeData(
          primarySwatch: Colors.blue,
          colorScheme: ColorScheme.fromSeed(seedColor: Colors.white),
        ),
        home: MyWidget(),
      );
}

class MyWidget extends StatefulWidget {
  const MyWidget({Key? key}) : super(key: key);

  @override
  State<MyWidget> createState() => _MyWidgetState();
}

class _MyWidgetState extends State<MyWidget> {
  @override
  Widget build(BuildContext context) {
    ScreenUtil.init(context, designSize: const Size(360, 780));
    return const SplashPage();
  }
}
